package action;

import interceptor.BoardDaoAware;
import util.BoardDAO;
import util.BoardVO;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2																																																																																																																										.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;

public class DeleteAction extends ActionSupport implements Preparable, ModelDriven, BoardDaoAware {
	private BoardVO vo;
	private BoardDAO dao;
	boolean result;
	
	public void setBoardDao(BoardDAO dao){
		System.out.println("점검1"+dao);
		this.dao = dao;
	}
	
	public BoardDAO getDao() {
		return dao;
	}

	public void setVo(BoardVO vo) {
		System.out.println("점검2"+vo);
		this.vo = vo;
	}

	public BoardVO getVo() {
		System.out.println("점검3"+dao);
		return vo;
	}

	public void setDao(BoardDAO dao) {
		System.out.println("점검4"+dao);
		this.dao = dao;
	}

	public void prepare() throws Exception {
		System.out.println("점검"+dao);
		vo = new BoardVO();
	}
	
	public Object getModel(){
		System.out.println("점검5"+dao);
		return vo;
	}
	
	@Override
	public String execute() throws Exception {
		System.out.println("점검6"+result);
		result = dao.passChk(vo);
		System.out.println("result="+result);
		if (result == true){
			dao.Delete(vo);
			return Action.SUCCESS;
		} else {
			System.out.println("점검7"+INPUT);
		return Action.INPUT;
		
		}
	}
}